SHA512 Password Hashing Command Line
(posted 2018.11.06, last updated 2021.10.07)

I wanted to add another user to my dovecot instance but did not want him to expose his password to me.

My dovecot instance uses SHA512 for password hashing and has no web interface, i.e. is configured directly via the database.

On the server I can use the doveadm to create a new Hash, but it is bundled with dovecot and I could not ask the user to install dovecot jsut to give me his hashed password.

doveadm pw -s SHA512-CRYPT

After some searching I figured that I can use pyhton:

python3 -c "import crypt;print(crypt.crypt(input('clear-text pw: '),crypt.mksalt(crypt.METHOD_SHA512)))"

But again, the user did not have pyhton installed and as far as OSX is concerned it looked like it is not like a simple "apt-get install python3" ..... Then I was looking for a simple JS implementation but was not able to find a simple one that incorporates (random) salting and rounds (doveadm defaults to 5k).

So I just wrote a small PHP script that does exaclty that: https://0in.de/crypter